package micro86.operation;

import micro86.engine.Memory;
import micro86.engine.State;

/**
 * Created with IntelliJ IDEA.
 * User: alar
 * Date: 04.03.13
 * Time: 17:25
 * To change this template use File | Settings | File Templates.
 */
public class Jle implements  IOperation {
    int index;

    public Jle (int index){
        this.index = index;
    }

    @Override
    public void execute(State state, Memory memory) {
        if (state.getZF() || state.getSF() != state.getOF()) {
            state.setIP(index);
        }
        else {
            state.incIP();
        }
    }
}
